<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="public/theme/backend/style/vds.css" />
<link rel="stylesheet" type="text/css" href="public/theme/backend/style/main.css" />
<script type="text/javascript" src="public/theme/backend/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="public/theme/backend/js/vds.js"></script>
<script type="text/javascript" src="public/theme/backend/js/juicer.js"></script>
<script type="text/javascript" src="public/theme/backend/js/list.js"></script>
<script type="text/javascript">
$(function(){searchRes(1);});

function searchRes(page_id){
  var type = $('#type').val(), kw = $('#kw').val();
  
  $.ajax({
    type: "post",
    dataType: "json",
    url: "<{url m=$MOD c='user' a='index' step='search'}>",
    data: {'type':type, 'kw':kw, 'page':page_id},
    beforeSend: function(){$('#loading').removeClass('hide');},
    success: function(data) {
      $('#rows').empty();$('#loading').addClass('hide');
      if(data.status == 1) {
        juicer.register('format_date', function(v){return formatTimestamp(v, 'y-m-d<br />h:i:s');});
        $('#rows').append(juicer($('#table-tpl').html(), data));
        $('#rows tr').vdsRowHover();
        $('#rows tr:even').addClass('even');
        if(data.paging != null) $('#rows').append(juicer($('#paging-tpl').html(), data));
      } else {
        $('#rows').append("<div class='nors mt5'>未找到匹配的数据记录...</div>");	
      }
    },
    error: function(){ 
      $('#loading').addClass('hide');
      $('body').vdsAlert({msg:"处理请求时发生错误"});
    }
  });
}
function pageturn(page_id){searchRes(page_id);}
</script>
</head>
<body>
<div class="content">
  <div class="loc"><h2><i class="icon"></i>用户列表</h2></div>
  <div class="box">
    <div class="doacts">
      <a class="ae btn" onclick="doslvent('<{url m=$MOD c='user' a='view'}>', 'id')"><i class="user"></i><font>用户信息</font></a>
      <a class="ae btn" onclick="doslvent('<{url m=$MOD c='user' a='view' step='order'}>', 'id')"><i class="list"></i><font>订单记录</font></a>
      <a class="ae btn" onclick="doslvent('<{url m=$MOD c='goods_review' a='index'}>', 'id', 'user_id')"><i class="cmt"></i><font>商品评价</font></a>
      <a class="ae btn" onclick="doslvent('<{url m=$MOD c='user' a='view' step='account'}>', 'id')"><i class="dols"></i><font>账户记录</font></a>
      <a class="ae btn" onclick="doslvent('<{url m=$MOD c='user' a='view' step='consignee'}>', 'id')"><i class="adr"></i><font>收件地址</font></a>
      <a class="ae btn" onclick="doslvent('<{url m=$MOD c='user' a='delete'}>', 'id')"><i class="remove"></i><font>删除</font></a>
    </div>
    <div class="stools mt5">
      <select id="type" class="slt">
        <option value="0" selected="selected">用户名</option>
        <option value="1">邮箱</option>
      </select>
      <input type="text" class="w300 txt" id="kw" placeholder="输入用户名/邮箱" />
      <button type="button" class="sbtn btn" onclick="searchRes(1)">搜 索</button>
    </div>
    <div class="module mt5" id="rows"></div>
    <script type="text/template" id="table-tpl">
      <table class="datalist">
        <tr>
          <th width="60" colspan="2">编号</th>
          <th class="ta-l">用户名</th>
          <th class="ta-l">邮箱</th>
          <th width="130">注册时间</th>
          <th width="130">最后登录时间</th>
          <th width="120">邮箱认证</th>
          <th width="120">用户状态</th>
        </tr>
        {@each list as v}
        <tr>
          <td width="20"><input name="id" type="checkbox" value="${v.user_id}" /></td>
          <td width="40">${v.user_id}</td>
          <td class="ta-l"><a class="blue" href="index.php?m=<{$MOD}>&c=user&a=view&id=${v.user_id}">${v.username}</a></td>
          <td class="ta-l">${v.email}</td>
          <td class="c888">$${v.created_date|format_date}</td>
          <td class="c888">$${v.last_date|format_date}</td>
          <td>{@if v.email_status == 1}<i class="icon yes"></i>{@else}<i class="icon no"></i>{@/if}</td>
          <td>{@if v.status == 0}<font class="green">正常</font>{@else}<font class="red">限制</font>{@/if}</td>
        </tr>
        {@/each}
      </table>
    </script>
    <{include file='backend/lib/paging.html'}>
    <div class="loading x-auto hide" id="loading"></div>
  </div>
</div>
</body>
</html>